package com.itheima.reggie.common;
/**
 * 基于ThreadLocal封装工具类，用户保存和获取当前登录用户id
 */
public class BaseContext {
    private static ThreadLocal<Long> threadLocal=new ThreadLocal<>();
//    线程中的id获取来存到ThreadLocal中

    /**
     * 存值
     * @param id
     */
    public static void setCurrendId(Long id){
        threadLocal.set(id);
    }

    /**
     * 取值
     * @return
     */
    public static Long getCurrendId(){
        Long aLong = threadLocal.get();
        return aLong;
    }
}
